package com.me.chat.util;

/**
 * 一些redis 所需要的key
 * @Author: qiu
 * @Date: 2021/2/4 15:23
 */
public class RedisKey {

    /**
     * redis key的前缀 keyPrefix
     */
    private final static String KEY_PREFIX = "PRIVATE_CHAT";

    /**
     * 分隔符
     */
    public final static String SPLIT = ":";


    /**
     * 用户信息的key
     * @param userId
     * @return
     */
    public static String userInfoKey (String userId) {

        return KEY_PREFIX+SPLIT+"USERINFO"+SPLIT+userId;
    }

    /**
     * 群组的key
     * @param groupId
     * @return
     */
    public static String groupInfoKey (String groupId) {

        return KEY_PREFIX+SPLIT+"GROUPINFO"+SPLIT+groupId;
    }

    /**
     * 当前用户所在的聊天室 hash的key头
     * @return
     */
    public static String chatNowRoomHashKey() {
        return KEY_PREFIX+SPLIT+"CHATROOM";
    }
}
